import Router from 'koa-router';
import { registerHandleApi } from '../lib/registerHandleApi';
import { validatorRouterFilter } from '../middleware/validatorRouterFilter';
import { validatorToken } from '../middleware/validatorToken';
import { userApis } from './api/user.router';
import { ipRouter } from './api/ip.router';
import { testRouter } from './test.router';
export const router = new Router;

// router.use();
router.use(validatorRouterFilter);
router.use(validatorToken);

const apiMap = [
  testRouter,
  userApis,
  ipRouter
];

apiMap.map(value => {
  router.use(registerHandleApi(value).routes());
})

router.stack.map(info => {
  // console.log(info);
  console.log(...info.methods, info.path);
})

export default router;

